<nav id="navbar" class="navbar navbar-default navbar-static-top" role="navigation">
    <div class="container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="logo" href="{{.AppUrl}}">
                <img src="{{.AppLogo}}">
            </a>
        </div>
        {{if .SearchEnabled}}
        <form id="navbar-search" class="navbar-form navbar-left {{if or .NativeSearch .SphinxEnabled}}{{else}}google{{end}}" role="search" action="{{.AppUrl}}search">
            <div class="form-group">
                <input class="form-control" type="text" placeholder="{{i18n .Lang "search"}}" name="q" {{if or .NativeSearch .SphinxEnabled}}value="{{.Q}}"{{end}}>
            </div>
        </form>
        {{end}}
        <div class="collapse navbar-collapse navbar-ex1-collapse">
            <ul class="nav navbar-nav">
                <li {{if .IsHome}}class="active"{{end}}><a href="{{.AppUrl}}">{{i18n .Lang "home"}}</a></li>
                <li><a target="_blank" href="http://blog.go-china.org">{{i18n .Lang "blog"}}</a></li>
                <li><a target="_blank" href="http://beego.me">{{i18n .Lang "beego_website"}}</a></li>
            </ul>
            <ul class="nav navbar-nav navbar-right navbar-menu">
                {{if .IsLogin}}
                <li class="dropdown avatar">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown"><img class="middle" src="{{.AvatarURL}}{{.User.GrEmail}}?size=48"></a>
                    <ul class="dropdown-menu">
                        {{if .User.IsAdmin}}
                            <li><a href="{{.AppUrl}}admin">{{i18n .Lang "admin.admin_center"}}</a></li>
                            <li class="divider"></li>
                        {{end}}
                        <li><a href="{{.User.Link}}"><span>{{i18n .Lang "user.home"}}</span></a></li>
                        <li><a href="{{.AppUrl}}settings/profile"><span>{{i18n .Lang "auth.user_profile"}}</span></a></li>
                        <li><a href="{{.AppUrl}}logout">{{i18n .Lang "auth.logout"}}</a></li>
                    </ul>
                </li>
                {{else}}
                <li class="dropdown{{if .IsLoginPage}} active{{end}}">
                    <a href="{{.AppUrl}}login" class="dropdown-toggle" data-toggle="dropdown">{{i18n .Lang "auth.login"}}</a>
                    <form id="dropdown-login" class="dropdown-menu cell" action="{{.AppUrl}}login" method="POST">
                        {{.xsrf_html}}{{.once_html}}
                        <div class="alert alert-info alert-small">
                            {{i18n .Lang "auth.login_your_account"}}
                        </div>
                        <div class="form-group">
                            <input class="form-control" name="UserName" type="text" placeholder="{{i18n .Lang "auth.login_username"}} / {{i18n .Lang "auth.login_email"}}" value="">
                        </div>
                        <div class="form-group">
                            <input class="form-control" name="Password" type="password" placeholder="{{i18n .Lang "auth.login_password"}}">
                        </div>
                        <p>
                            <label>
                                <input type="hidden" name="Remember" value="0">
                                <button type="button" data-toggle="button" data-name="Remember" value="0" class="btn btn-default btn-xs btn-checked"><i class="icon icon-ok"></i></button>{{i18n .Lang "auth.login_remember_me"}}
                            </label>
                            <span class="pull-right"><a href="{{$.AppUrl}}forgot"><i class="icon-question-sign"></i> {{i18n .Lang "auth.forgot_password"}}</a></span>
                        </p>
                        <button class="btn btn-primary btn-block" type="submit">{{i18n .Lang "auth.login"}}</button>
                        <div class="auth-socials">
                            <a href="{{.AppUrl}}login/google" class="icon-google-plus google"></a>
                            <a href="{{.AppUrl}}login/github" class="icon-github github"></a>
                            <!-- <a href="{{.AppUrl}}login/weibo" class="icon-weibo weibo"></a> -->
                            <!-- <a href="{{.AppUrl}}login/qq" class="icon-qq-round qq"></a> -->
                        </div>
                    </form>
                </li>
                <li {{if .IsRegister}}class="active"{{end}}><a href="{{.AppUrl}}register">{{i18n .Lang "auth.register"}}</a></li>
                {{end}}
            </ul>
        </div>
    </div>
</nav>
